<template>
    <div id="">
       <!-- 购物车-->
        <!--数据展示-->
        <div class="dingd"></div>
        <!--无数据展示-->
        <div class="hai" v-if="this.lie == ''">你还没有订单哦</div>
    </div>
</template>

<script>
    import { Toast } from 'mint-ui';
	export default {
		name: "",
		data() {
			return {
			    list:[],
                user:{},
                lie:[]
            }
		},
        created(){
            this.user = JSON.parse(sessionStorage.getItem("data"));
            //console.log(this.user)
            //this.add();
            this.getdo();
        },
		methods: {
		    //获取购物车列表  数据为空
		    getdo:function(){
                let param = new URLSearchParams();//new Object();
                param.user_id=this.user.id;
                this.$ajax({
                    methods:'post',
                    url:'http://134.175.237.162/index.php/Shop_cart/getShopList',
                    data:param
                }).then((res) =>{
                    this.lie = res.data;
                    console.log(res)
                }).catch(() => {
                    console.log('网络异常')
                })
            },
            //添加数据
            add: function () {
                let param =new Object();
                param.info={"user_id":1,"create_time":new Date(),"course_id":2};
                //用户id
                //创建时间
                //课程id
                var par = JSON.stringify(param);
                this.$ajax({
                    method: 'post',
                    url: 'http://134.175.237.162/index.php/info/addShop',
                    data:par
                }).then((res) => {
                    if(res.data.code==0){
                        //this.list = res.data.data.data;
                        console.log(res)
                    }else{
                        console.log('请求异常')
                    }
                }).catch(() => {
                    console.log('网络异常')
                })
            }
        }
	}
</script>

<style scoped>
    .hai{
        text-align: center;
    }
</style>
